﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
namespace SocialWebpart
{
    public class JSONForFaceBook
    {

        /// <summary>
        /// Creates a JSONObject by parsing a string.
        /// </summary>
        public static RootObj CreateFromString(string s)
        {
            RootObj objJson;
            JavaScriptSerializer objSerializer = new JavaScriptSerializer();
            try
            {
                objJson = objSerializer.Deserialize<RootObj>(s);
            }
            catch (ArgumentException)
            {
                throw new Exception("JSONException", new Exception("Not a valid JSON string."));
            }
            return objJson;
        }
    }

    public class Data
    {
        public string message { get; set; }
        public string created_time { get; set; }
        public string picture { get; set; }
    }


    public class RootObj
    {
        public List<Data> data { get; set; }
    }
}
